package com.study.utils;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.Environment;

/**
 * @author zhuzi
 * 2024/3/25 23:33
 */
public interface Consts {
    String TopicName = "redis:topic:one";

    public static void main1(String[] args) {
        // 手动创建 ApplicationContext
        ApplicationContext context = new AnnotationConfigApplicationContext();
        // 获取 Environment 对象
        Environment env = context.getEnvironment();
        // 读取配置文件中的值
        String value = env.getProperty("myname");


        System.out.println("配置文件中的值: " + value);
    }

    public static void main(String[] args) {
        String myname = EnvironmentUtils.getProperty("myname");
        System.out.println(myname);
    }
}
